package com.nbsaas.boot.agent.rest.convert;

import com.nbsaas.boot.entity.agent.Agent;
import com.nbsaas.boot.agent.api.domain.simple.AgentSimple;

import com.nbsaas.boot.rest.api.Converter;

/**
* -列表对象转换器
*/

public class AgentSimpleConvert implements Converter<AgentSimple, Agent> {




@Override
public AgentSimple convert(Agent source) {
    AgentSimple result = new AgentSimple();


                try {
                    if(source.getCatalog()!=null){
                        result.setCatalogName(source.getCatalog().getName());
                    }
                } catch (Exception ignored) { }

                result.setConfigJson(source.getConfigJson());
                result.setNote(source.getNote());
                result.setSystemPrompt(source.getSystemPrompt());

               try {
                   if(source.getCatalog()!=null){
                       result.setCatalog(source.getCatalog().getId());
                   }
                } catch (Exception ignored) { }

                result.setName(source.getName());
                result.setTemperature(source.getTemperature());
                if(source.getStoreState()!=null){
                    result.setStoreStateName(String.valueOf(source.getStoreState()));
                }
                result.setStoreState(source.getStoreState());
                result.setId(source.getId());
                result.setVersion(source.getVersion());
                result.setAddDate(source.getAddDate());
                result.setLastDate(source.getLastDate());


    return result;
}

}